
class Stack {

private double[]    stack;
private int         top;

Stack () {
    stack = new double[512];
    top = 511;
    stack [ top ] = 0;
}

public double   
pop ()     
{ 
    double value = stack[top];

//  System.out.println ( "pop  " + value );
    top = ( top < 511 ? ++top : 511 ); 
    return ( value );
} 

public void     
push ( double value )
{
//  System.out.println ( "push " + value );
    stack [--top] = value;
} 

};
